package canss.webservice.model;

import java.io.Serializable;

import canss.supports.basic;

public class EventDescription implements Serializable
{
	private static final long serialVersionUID = -5922512535892190575L;

	private Integer eventid = 0;
	private Integer level = 0;
	private String eventname = "";
	private String oneLineDesc = "";

	public EventDescription()
	{
		super();
	}

	public EventDescription(Integer _eventid)
	{
		super();
		this.eventid = (_eventid == null) ? 0 : _eventid;
	}

	public Integer getEVENTID()
	{
		return eventid;
	}

	public void setEVENTID(Integer _eventid)
	{
		eventid = _eventid;
	}

	public Integer getLEVEL()
	{
		return level;
	}

	public void setLEVEL(Integer _level)
	{
		level = _level;
	}

	public String getEVENTNAME()
	{
		return eventname;
	}

	public void setEVENTNAME(String _eventname)
	{
		eventname = _eventname == null ? "" : _eventname;
	}

	public String getONELINEDESC()
	{
		return oneLineDesc;
	}

	public void setONELINEDESC(String _oneLineDesc)
	{
		oneLineDesc = _oneLineDesc == null ? "" : _oneLineDesc;
	}

	
	
	/**
	 * default: single xml
	 * @return
	 */
	public static final String toXML(boolean _singlefile, EventDescription[] _list)
	{
		StringBuffer strbuf = new StringBuffer();
		
		if(_singlefile)
			strbuf.append(basic.getXMLStart());
		{
			strbuf.append("<canssEvent:eventGroup>");
			
			if(_list!=null)
			{
				for(EventDescription desc : _list)
					if(desc!=null)
						strbuf.append(desc.toString());
			}
			
			strbuf.append("</canssEvent:eventGroup>");
		}
		if(_singlefile)
			strbuf.append(basic.getXMLEnd());
		
		return strbuf.toString();
	}
	
	public String toString()
	{
		StringBuffer strbuf = new StringBuffer();
		
		strbuf.append("<canssEvent:eventDescription>");
		strbuf.append("<canssEvent:EventID>");
		strbuf.append(""+eventid);
		strbuf.append("</canssEvent:EventID>");
		strbuf.append("<canssEvent:Level>");
		strbuf.append(""+level);
		strbuf.append("</canssEvent:Level>");
		strbuf.append("<canssEvent:EventName>");
		strbuf.append(""+eventname);
		strbuf.append("</canssEvent:EventName>");
		strbuf.append("<canssEvent:OneLineDesc>");
		strbuf.append(""+oneLineDesc);
		strbuf.append("</canssEvent:OneLineDesc>");
		strbuf.append("</canssEvent:eventDescription>");
		
		return strbuf.toString();
	}

}
